﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UReturnVisitDetailSelect.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.UserModel.UReturnVisitDetailSelect" %>
<%--选择项--%>
<form id="form1" runat="server" method="post" action="UserModel/UReturnVisitDetailSelect.aspx" onsubmit="return dialogSearch(this);">

<div class="pageContent">
    <asp:repeater id="rpMenu" runat="server">
        <HeaderTemplate>
        <table class="list" width="100%" layouth="10" targetType="dialog">
        <thead>
            <tr  >                
                <th >不满意项目</th>
                <th >选中</th>             
            </tr>
        </thead>
        <tbody>
        </HeaderTemplate>
        <ItemTemplate>
            <tr >
                <td><%# Eval("TempContent")%></td>				
			    <td>
                    <input type="checkbox" class="onUReturnVisitDetailSelect" TempId="<%# Eval("TempID") %>" TempContent="<%# Eval("TempContent") %>" />
				</td>
			</tr>
        </ItemTemplate>
        <FooterTemplate>
            </tbody>
         </table>
        </FooterTemplate>
    </asp:repeater>
</div>
<script>
    $(document).ready(function () {
        $("input.onUReturnVisitDetailSelect").click(function () {
          
            var $TempId = $(this).attr("TempId");
            var $TempContent = $(this).attr("TempContent");
            var $Par_detailid = "#<%=Par_detailid %>";
            var $otherRemarkId = "#<%=otherRemark %>";

            var parDetailId = $($Par_detailid).val();

            if ($(this).attr("checked")) {
                if (parDetailId.indexOf("," + $TempId + ",") == -1) {
                    $($Par_detailid).val("," + $TempId + "," + $($Par_detailid).val());
                    $($otherRemarkId).val($TempContent + "," + $($otherRemarkId).val());
                }
            }
            else {
                $($Par_detailid).val(parDetailId.replace("," + $TempId + ",", ""));
                $($otherRemarkId).val($($otherRemarkId).val().replace($TempContent + ",", ""));
            }

        });

        var $Par_detailidVal = $("#<%=Par_detailid %>").val();
        $("input.onUReturnVisitDetailSelect").each(function () {
            // var tempid = ",7,"; 
            var tempid = $(this).attr("TempId");
            if ($Par_detailidVal.indexOf("," + tempid + ",") == -1) {
                $(this).attr("checked", "");
            }
            else {
                $(this).attr("checked", "checked");
            }
        })

    })
    
</script>
</form>
